package cn.bincker.mybatis.encrypt.converter.impl;

import java.nio.ByteBuffer;
import java.time.Year;

public class YearEncryptConverter extends BaseEncryptConverter<Year>{
    @Override
    public Year convertNonNull(byte[] data) {
        return Year.of(ByteBuffer.wrap(data).getInt());
    }

    @Override
    public byte[] convertNonNull(Year object) {
        var result = new byte[Integer.BYTES];
        ByteBuffer.wrap(result).putInt(object.getValue());
        return result;
    }
}
